class Dep {
    constructor () {
        // 存放watcher
        this.sub = []
    }
    // 添加订阅者
    addSub (watcher) {
        // 将订阅者存放到数组中
        this.sub.push(watcher)
    }
    // 通知订阅者
    notify () {
        this.sub.forEach(watcher => watcher.update())
    }

}
